<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/common/tags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <meta name="Keywords" content="">
    <meta name="description" content="">
    <%@include file="/common/style.jsp" %>
    <link rel="stylesheet" type="text/css" href="${static_url}/ui/app/assets/css/shop.css">
    <link rel="stylesheet" type="text/css" href="${static_url}/ui/app/assets/css/sub.css">
    <link rel="stylesheet" type="text/css" href="${static_url}/ui/app/assets/css/uc.css">

    <%@include file="/common/javascript.jsp" %>
</head>
<body class="wide">
<!-- 头部 -->
<%@include file="/common/myHeader.jsp" %>
<!-- /头部 -->

<!-- 主体 -->
<div style="border-top: solid 1px #dcdcdc;" class="mb10"></div>
<div class="g">
    <!--面包屑 -->
    <%--<div class="breadcrumb-area"><a href="/" title="首页">首页</a>&nbsp;&nbsp;\&nbsp;&nbsp;<em
            id="personCenter"><span>我的商城</span></em><em id="pathPoint"></em><span id="pathTitle"></span></div>--%>
</div>
<div class="h20"></div>
<div class="g">
    <div class="fr u-4-5"><!-- 20141212-栏目-start -->
        <div class="section-header">
            <div class="fl">
                <h2><span>我的商品 <c:if test="${ishop.role=='xiaoer'}"><a href="${ctx}/my/seller/addGoods.htm">[新建]</a></c:if></span></h2>
            </div>
        </div>
        <div class="h20"></div>
        <div id="pro-tab-area" class="pro-detail-tab clearfix">
            <div class="pro-detail-tab-nav">
                <ul>
                    <li id="pro-tab-feature1" class="current"><a href="javascript:;" title="已上架商品"><span>已上架商品(${pager.totalRecord}套)</span></a></li>
                    <li id="pro-tab-feature2" ><a href="${ctx}/my/seller/myGoodsNot.htm" title="未上架商品"><span>未上架商品</span></a></li>
                </ul>
            </div>
        </div>
        <div class="pro-detail-area">
            <div id="pro-tab-feature-content" class="pro-detail-tab-area p5">
                <%@include file="cate.jsp"%>
                <div class="myRes-record">
                    <div class="list-group-title" id="list-group-title">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <thead>
                            <tr>
                                <th class="col-check w20"><input type="checkbox"/></th>
                                <th class="w90"></th>
                                <th class="col-pro">基本信息</th>
                                <th class="col-date-res">房主</th>
                                <th class="col-date-buy">刷新</th>
                                <th class="col-date-buy">预约刷新</th>
                                <th class="col-operate">操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="list-group" id="list-group">
                        <div class="list-group-item">
                            <div class="o-pro">
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tbody>
                                    <c:forEach items="${pager.records}" var="item">
                                        <tr id="goods_${item.id}">
                                            <td class="col-check w20"><input type="checkbox" name="id" value="${item.id}"/></td>
                                            <td class="w90"> <img src="${myfn:mainImg(item.id)}" alt="1.jpg" width="78" height="78"></td>
                                            <td class="col-pro-info pl10 col-pro-info-title" style="padding-left: 10px;">
                                                <p>
                                                    <a title="${item.name}" href="${ctx}/my/seller/editGoods.htm?id=${item.id}">${item.name}</a>[${item.community_name}]
                                                </p>
                                                <p>
                                                    <span>${item.housesize}㎡</span><em>,</em>
                                                    <span>${item.room}室${item.hall}厅${item.toilet}卫</span><em>,</em>
                                                    <span>${item.housefloor}层</span><em>,</em>
                                                    <span>${item.decorate}</span><em>,</em>
                                                    <span><b style="color: #eb5f00;">${item.price}万</b></span><em></em>
                                                </p>
                                                <p>
                                                   <b>最后刷新:${myfn:formatTimestamp(item.refresh_time)}</b>
                                                </p>
                                            </td>
                                            <td class="col-date-res">
                                                <p>${item.owner}</p>
                                                <p>${item.owner_phone}</p>
                                            </td>

                                            <td class="col-date-buy">
                                                <p>已刷新<b id="refresh_${item.id}">${item.refresh}</b>次</p>
                                                <p><a href="javascript:refreshClick(${item.id})">刷新</a></p>
                                            </td>
                                            <td class="col-date-buy">

                                            </td>
                                            <td class="col-operate">
                                                <c:if test="${ishop.role=='xiaoer'}">
                                                    <p>
                                                    <a href="${ctx}/my/seller/editGoods.htm?id=${item.id}"><span>编辑</span></a>
                                                    <a href="javascript:deleteGoods(${item.id})"><span>删除</span></a>
                                                    </p>
                                                    <p>
                                                        <a href="javascript:offGoods(${item.id})"><span>下架</span></a>
                                                        <a href="javascript:deleteGoods(${item.id})"><span>标签</span></a>
                                                    </p>
                                                </c:if>
                                                <c:if test="${ishop.role=='seller'}">
                                                    暂无操作
                                                </c:if>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </div>
                    <div class="list-group-page">
                        <div class="multi-page">
                            <c:if test="${pager.totalRecord>0}">
                                <jsp:include page="/common/ui/pagerUI.jsp">
                                    <jsp:param name="pageNo" value="${pager.pageNo}"/>
                                    <jsp:param name="pageCount" value="${pager.pageCount}"/>
                                    <jsp:param name="total" value="${pager.totalRecord}"/>
                                    <jsp:param name="callback" value="callback"/>
                                </jsp:include>
                            </c:if>

                            <c:if test="${pager.totalRecord<=0}">
                                暂无数据！
                            </c:if>
                            <script>
                                function callback(pageNo){
                                    alert(pageNo);
                                }
                            </script>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="fl u-1-5">
        <!--左边菜单 -->
        <%@include file="left.jsp" %>
    </div>
    <div class="hr-45"></div>


</div>
<script>
    function deleteGoods(goodsId){
        if(confirm("确定删除？")){
            $.post("${ctx}/my/seller/deleteGoods.htm",{id:goodsId},function(data){
                if(data.status){
                    alert("删除成功！");
                    $("#goods_"+goodsId).remove();
                }else{
                    alert("删除失败！");
                }
            },"json");
        }
    }

    function offGoods(goodsId){
        if(confirm("确定下架？")){
            $.post("${ctx}/my/seller/offGoods.htm",{id:goodsId},function(data){
                if(data.status){
                    alert("下架成功！");
                    $("#goods_"+goodsId).remove();
                }else{
                    alert("下架失败！");
                }
            },"json");
        }
    }

    function refreshClick(goodsId){
        $.post("${ctx}/my/seller/refresh.htm",{id:goodsId},function(data){
            if(data.status){
                alert("刷新成功！");
               var count =parseInt($("#refresh_"+goodsId).text()) ;
                $("#refresh_"+goodsId).text(count+1)
            }else{
                alert(data.message);
            }
        },"json");
    }
</script>
<!-- /主体 -->


<!-- 底部 -->
<%@include file="/common/footer.jsp" %>
<!-- /底部 -->

</body>
</html>
